# 该函数用于检查当前假设的狼人组合是否满足条件
def check_conditions(N, statements, wolves):
    lie_count = 0  # 统计说谎的玩家数量
    wolf_lie_count = 0  # 统计说谎的狼人数量

    # 遍历每个玩家的发言
    for i in range(N):
        player_num = i + 1  # 当前发言玩家的编号
        target_num = abs(statements[i])  # 目标玩家的编号
        is_target_wolf = target_num in wolves  # 判断目标玩家是否为狼人

        # 判断当前玩家的发言是否为假
        if (statements[i] > 0 and is_target_wolf) or (statements[i] < 0 and not is_target_wolf):
            lie_count += 1
            if player_num in wolves:
                wolf_lie_count += 1

    # 检查是否满足有 2 人说假话，且有狼人说谎但并非所有狼人都说谎的条件
    return lie_count == 2 and 0 < wolf_lie_count < 2


# 主函数，用于求解狼人组合
def math_learn(N, statements):
    # 枚举所有可能的两人组合作为狼人
    for i in range(1, N):
        for j in range(i + 1, N + 1):
            wolves = [i, j]  # 当前假设的狼人组合
            if check_conditions(N, statements, wolves):
                return wolves  # 如果满足条件，返回该狼人组合
    return None  # 如果没有找到符合条件的组合，返回 None


# 读取输入
N = int(input())
statements = []
for _ in range(N):
    statements.append(int(input()))

# 调用主函数求解
result = math_learn(N, statements)

# 输出结果
if result:
    print(f"{result[0]} {result[1]}")
else:
    print("No Solution")
